<?php
/*
Description: This file is used to change login paassword.
*/
#########IncludeFiles####################################################################################
include_once '../inc/config.php';
include_once("../inc/bootstrape.php");
require_once _SITE_PATH_.'classes/UsersMaster/UsersMaster.php';
require_once _SITE_PATH_.'classes/CommonUtility/CommonUtility.php';
//	END CHANGE PASSWORD CODE	//
$errMsg = $_GET['err'];
$action = trim($_REQUEST['action']);
$id = trim($_REQUEST['id']); 
if(empty($id)) header("Location"._SITE_ADMIN_URL_."users/user_mng.php");

if(isset($_POST['submit'])){	
    /*$parms['first_name'] = $_POST['first_name'];
    $parms['last_name'] = $_POST['last_name'];
    $parms['email_id'] = $_POST['email_id'];
    $parms['mobile_no'] = $_POST['mobile_no'];
    $parms['first_name'] = $_POST['first_name'];
    $parms['modified'] = date('Y-m-d H:i:s');
    
    $condition = array(); 
    $condition['id'] = $id;
    if( CommonUtility::updateData($parms, 'access_group', $condition)) {        
        header("Location: access_group_mng.php?msg=1063");
        exit;
    }
    */
    $params=array();
	foreach($_POST as $key =>$val){
		$params[$key] =$val;
	}
	$params[dob] = $params[dobyear]."-".$params[dobmonth]."-".$params[dobday];
	$params[anniversary_date] = $params[anniversaryyear]."-".$params[anniversarymonth]."-".$params[anniversaryday];
	if(UsersMaster::userUpdate($params)){
		$errMsg = "userupdated";
		echo "<script>location.href='"._SITE_ADMIN_URL_."users/users_mng.php?err=".$errMsg."';</script>";
		//header("Location"._SITE_ADMIN_URL_."users/user_mng.php?err=".$errMsg);
	}else{
		$errMsg = "emailexists";
	}
}
$res = UsersMaster::getUsersDetail($id);
$country = CommonUtility::getCountry();
$state = CommonUtility::getState($res[0]['country']);
$city = CommonUtility::getCity($res[0]['state']);
$row = $res[0];
$_tplName = 'users/users_edit.tpl';
$_title = 'Edit User';
require_once _ADMIN_TPL_MAIN_;
?>